#pragma once
#include "..\..\Cpu.h"

namespace TCServer
{
    namespace RPHandler
    {
        class AbstractHandler
        {
        protected:
            template<typename Class, typename Func>
            void setOn(const QString &str, Class ptr, Func func)
            {
                Cpu::instance()->setOn(str, [this, ptr, func](QSslSocket *s, QVariantMap args)
                {
                    QByteArray data;
                    QDataStream stream(&data, QIODevice::WriteOnly);
                    (ptr->*func)(stream, args);
                    s->write(data);
                });
            }
        };
    }
}